package com.jprocms.module.cms.controller.admin.sitetpl.vo;

import cn.hutool.core.io.FileUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;

@Schema(description = "模板列表vo")
@Data
public class SiteTplListVo {

    public static final List<String> EDIT_RE_SUFFIX = Arrays.asList("js", "css", "json", "html", "htm");

    public boolean getEditable() {
        if (getDirectory()) {
            return false;
        }
        if (EDIT_RE_SUFFIX.contains(FileUtil.getSuffix(filename))) {
            return true;
        }
        return false;
    }

    LocalDateTime lastModifiedDate;
    String filename;
    int size;
    String name;
    String root;
    Boolean directory;
    List<SiteTplListVo> children;
}
